<?php
    if(!$this->session->userdata('logged_in')) {
        redirect('logout');
    }
?>
<div id="separator"></div>
<?php 
    function nl2p($string, $line_breaks = true, $xml = true) {

    $string = str_replace(array('<p>', '</p>', '<br>', '<br />'), '', $string);

    // It is conceivable that people might still want single line-breaks
    // without breaking into a new paragraph.
    if ($line_breaks == true)
        return '<p>'.preg_replace(array("/([\n]{2,})/i", "/([^>])\n([^<])/i"), array("</p>\n<p>", '$1</p'.($xml == true ? '' : '').'><p>$2'), trim($string)).'</p>';
    else 
        return '<p>'.preg_replace(
        array("/([\n]{2,})/i", "/([\r\n]{3,})/i","/([^>])\n([^<])/i"),
        array("</p>\n<p>", "</p>\n<p>", '$1<br'.($xml == true ? '/' : '').'>$2'),

        trim($string)).'</p>'; 
    }
?>
<div id="bulletin_container">
    <div id="full_story">
        <?php 
            if(($this->uri->segment(4) === 'index') || ($this->uri->segment(2) === 'posts')) {
                echo '<a href="'.site_url().'authenticated/posts">'.img($img).'<span id="back">BACK</span></a><br/>';
            } else if(($this->uri->segment(4) === 'bulletin') || ($this->uri->segment(2) === 'bulletin' ) || ($this->uri->segment(2) === 'all_bulletin_post')) {
                echo '<a href="'.site_url().'authenticated/bulletin/posts">'.img($img).'<span id="back">BACK</span></a><br/>';
            } else if(($this->uri->segment(4) === 'group') || ($this->uri->segment(2) === 'group_post') || ($this->uri->segment(2) === 'all_group_post')) {
                echo '<a href="'.site_url().'authenticated/group/posts">'.img($img).'<span id="back">BACK</span></a><br/>';
            } else if($this->uri->segment(2) === 'groups_post') {
                echo '<a href="'.site_url().'authenticated/groups">'.img($img).'<span id="back">BACK</span></a><br/>';
            }
        ?>
        <div id="full_story_date_pub">
            <p class="full_story_pub_day"><?php echo $full_story['day']; ?></p>
            <p class="full_story_pub_month"><?php echo $full_story['month']; ?></p>
            <p class="full_story_pub_year"><?php echo $full_story  ['year']; ?></p>
        </div>
        <p id="full_story_title"><?php echo $full_story['title']; ?></p>
        <hr/>
        <div id="full_story_text">
            <?php echo nl2p($full_story['full_text']);?>
        </div>
    </div>
    <div class="balancer"></div>
</div>